﻿using System.Collections;
using UnityEngine;

namespace Assets.Scripts.UI
{


    public class MyCameraController : MonoBehaviour
    {
        private GameObject[] cameras;
        public int cameraNum = 5;

        void Start()
        {
            for (int i = 0; i < cameraNum; ++i)
            {
                //cameras[i] = GameObject.Find(string.Format("Camera{0}",i));
            }

            //SwitchCamera(0);
        }

        // Update is called once per frame

        public bool SwitchCamera(int cid = 0)
        {
            if (cid >= cameraNum)
                return false;
            else
            {
                for (int i = 0; i < cameraNum; ++i)
                {
                    if (i == cid)
                        cameras[i].SetActive(true);
                    else
                        cameras[i].SetActive(false);
                }
                return true;
            }
        }

        void Update()
        {
            if (Input.GetKeyDown(KeyCode.LeftControl))
            {
                if (Input.GetKeyDown(KeyCode.Alpha0))
                {
                    SwitchCamera(0);
                }

                if (Input.GetKeyDown(KeyCode.Alpha1))
                {
                    SwitchCamera(1);
                }

                if (Input.GetKeyDown(KeyCode.Alpha2))
                {
                    SwitchCamera(2);
                }
                if (Input.GetKeyDown(KeyCode.Alpha3))
                {
                    SwitchCamera(3);
                }
                if (Input.GetKeyDown(KeyCode.Alpha4))
                {
                    SwitchCamera(4);
                }
            }

        }
    }

}